package com.qjj.studydainty.Db;
/*
 * Title:       <br>
 * Description: <br>
 *
 * @author 曲建金
 * @version 1.0
 */

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class DBHelper extends SQLiteOpenHelper {

    private static final int DB_VERSION = 1;

    public DBHelper(@Nullable Context context) {
        super(context, "webView.db", null, DB_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        //数据库第一次被创建时将调用onCreate
        db.execSQL("CREATE TABLE IF NOT EXISTS history ("
                + "id INTEGER PRIMARY KEY AUTOINCREMENT,"
                + "name VARCHAR(50),"
                + "url VARCHAR(255))");
        db.execSQL("CREATE TABLE IF NOT EXISTS marker ("
                + "id INTEGER PRIMARY KEY AUTOINCREMENT,"
                + "name VARCHAR(50),"
                + "url VARCHAR(255))");


    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        //当数据库版本发生变化时会调用onUpgrade
        //这里可写更新数据表的操作(谨慎使用)，也可空着不写
    }
}
